import { Button, Tooltip } from 'antd';
import React, { useState } from 'react';

interface AgentGroupList {
	groups?: any[];
}

const GroupList = (props: AgentGroupList) => {
	const { groups } = props;
	const getGroupName = () => {
		const names = groups?.map(item => item.name);
		return names && names.join('，');
	};
	const [groupsListTipsView, setGroupsListTips] = useState<boolean>(false);
	const onClick = () => {
		let div = document.getElementsByClassName('group-list-box');
		if (div[0].scrollHeight > div[0].offsetHeight) {
			console.log('超出');
			setGroupsListTips(!groupsListTipsView);
		} else {
			console.log('没有超出');
		}
	};
	return (
		<div>
			<div className="group-list-box" onClick={onClick}>
				{getGroupName()}
				<div className="groups-list-tips">{getGroupName()}</div>
			</div>
		</div>
	);
};

export default GroupList;
